// =====================================================================================
//  Copyright (C) 2024 by Jiaxing Shao. All rights reserved

//  文 件 名:  TargetCube.h
//  作    者:  Jiaxing Shao, 980853650@qq.com
//  创建时间：  2024-08-01 22:09
//  描    述:  
// =====================================================================================
#pragma once

#include "IndexBuffer.h"
#include "ShaderProgram.h"
#include "VertexArray.h"
#include <glm/glm.hpp>
#include <cstdint>
#include <memory>
#include <vector>

struct CubeVertexElement {
    glm::vec3 position;
    glm::vec3 color;
    glm::vec2 texture;
};

class TargetCube {
public:
    TargetCube();
    ~TargetCube();

public:
    void setPosition(glm::vec3 position);
    void setScale(glm::vec3 scale);
    void setRotate(glm::vec3 angle);
    void render(glm::mat4 view, glm::mat4 proj);

private:
    void updateModel();

private:
    std::vector<CubeVertexElement> m_vertices;
    std::vector<uint32_t>          m_indices;
    glm::mat4                      m_model;
    glm::vec3                      m_position;
    glm::vec3                      m_scale;
    glm::vec3                      m_angle;

private:
    std::shared_ptr<ShaderProgram> m_shader;
    std::shared_ptr<VertexArray>   m_vao;
    std::shared_ptr<VertexBuffer>  m_vbo;
    std::shared_ptr<IndexBuffer>   m_ibo;
};